package ij.hkust.gui.laserCtr.STORM;

import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;

/**
 * use to record one step of one laser's data.
 * @author linshan
 *
 */
public class OneFrame extends JLabel{
	
	private static final long serialVersionUID = 1L;
	
	private int time;
	private int intensity;//the intensity of each laser
	private int countTime;//the time that from the start of the period to this.
	
	private int periodTime;
	private StormLaser parent;
	public OneFrame(){
		super();
		this.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				OneFrame tmp = (OneFrame)arg0.getSource();
				parent.cleanColor();
				tmp.setForeground(Color.red);
				parent.setSelectFrame(tmp);
				parent.clicked();
			}
		});
	}
	
	public OneFrame(int time,int intensity){
		super();
		this.time = time;
//		this.activate = ac;
		this.intensity = intensity;
		this.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				OneFrame tmp = (OneFrame)arg0.getSource();
				parent.cleanColor();
				tmp.setForeground(Color.red);
				parent.setSelectFrame(tmp);
				parent.clicked();
			}
		});
	}

	
	
	/**
	 * rewrite the function to show a cell have been set
	 */
	@Override
	public String toString() {
		return "ON";
	}
	/**
	 * get the laser of this frame.
	 * @return
	 */
	public String getLaser(){
		return parent.getLaser();
	}
	public int getTime() {
		return time;
	}
	public void setTime(int time) {
		this.time = time;
	}
	public int getIntensity() {
		return intensity;
	}
	public void setIntensity(int intensity) {
		this.intensity = intensity;
	}

	public StormLaser getParent() {
		return parent;
	}

	public void setParent(StormLaser parent) {
		this.parent = parent;
	}

	public int getCountTime() {
		return countTime;
	}
	public void setCountTime(int countTime) {
		this.countTime = countTime;
	}

	public int getPeriodTime() {
		return periodTime;
	}

	public void setPeriodTime(int periodTime) {
		this.periodTime = periodTime;
	}
	
}
